Skip to main content

Interface: Analyzer

Hierarchy

Properties

fftSize

fftSize: number


frequencyBinCount

Readonly frequencyBinCount: number


maxDecibels

maxDecibels: number


minDecibels

minDecibels: number


node

Readonly node: AnalyserNode


smoothingTimeConstant

smoothingTimeConstant: number

Methods

connect

connect(destinationNode, output?, input?): AudioNode

Parameters

NameType
destinationNodeAudioNode
output?number
input?number

Returns

AudioNode

Inherited from

BaseAudioNode.connect

connect(destinationParam, output?): void

Parameters

NameType
destinationParamAudioParam
output?number

Returns

void

Inherited from

BaseAudioNode.connect


disconnect

disconnect(): void

Returns

void

Inherited from

BaseAudioNode.disconnect

disconnect(output): void

Parameters

NameType
outputnumber

Returns

void

Inherited from

BaseAudioNode.disconnect

disconnect(destinationNode): void

Parameters

NameType
destinationNodeAudioNode

Returns

void

Inherited from

BaseAudioNode.disconnect

disconnect(destinationNode, output): void

Parameters

NameType
destinationNodeAudioNode
outputnumber

Returns

void

Inherited from

BaseAudioNode.disconnect

disconnect(destinationNode, output, input): void

Parameters

NameType
destinationNodeAudioNode
outputnumber
inputnumber

Returns

void

Inherited from

BaseAudioNode.disconnect

disconnect(destinationParam): void

Parameters

NameType
destinationParamAudioParam

Returns

void

Inherited from

BaseAudioNode.disconnect

disconnect(destinationParam, output): void

Parameters

NameType
destinationParamAudioParam
outputnumber

Returns

void

Inherited from

BaseAudioNode.disconnect


getAverageVolume

getAverageVolume(buffer): number

Utility function to get the average volume from getByteFrequencyData

Remarks

This is a better option when you only need to get the volume in terms of performance and complexity.

Parameters

NameType
bufferFloat32Array

Returns

number


getByteFrequencyData

getByteFrequencyData(buffer): void

Copies the current frequency data into a Uint8Array (unsigned byte array) passed into it.

The frequency data is composed of integers on a scale from 0 to 255.

Remarks

The bytes versions are not cheaper than the float version but provided for convenient: the byte version are computed from the float version, using simple quantization to 2^8 values ref. https://padenot.github.io/web-audio-perf/#analysernode

Parameters

NameTypeDescription
bufferUint8ArrayUse provided buffer instead of creating a new one

Returns

void


getByteTimeDomainData

getByteTimeDomainData(buffer): void

Copies the current waveform, or time-domain, data into a Uint8Array (unsigned byte array) passed into it.

If the array has fewer elements than the AnalyserNode.fftSize, excess elements are dropped. If it has more elements than needed, excess elements are ignored.

Remarks

The bytes versions are not cheaper than the float version but provided for convenient: the byte version are computed from the float version, using simple quantization to 2^8 values ref. https://padenot.github.io/web-audio-perf/#analysernode

Parameters

NameTypeDescription
bufferUint8ArrayUse provided buffer instead of creating a new one

Returns

void


getFloatFrequencyData

getFloatFrequencyData(buffer): void

Copies the current waveform, or time-domain, data into Float32Array passed into it

Remarks

The buffer size should be the same as AnalyserNode.frequencyBinCount

Parameters

NameTypeDescription
bufferFloat32ArrayUse provided buffer instead of creating a new one

Returns

void


getFloatTimeDomainData

getFloatTimeDomainData(buffer): void

Copies the current waveform, or time-domain, data into Float32Array passed into it

Remarks

The buffer size should be the same as AnalyserNode.fftSize

Parameters

NameTypeDescription
bufferFloat32ArrayUse provided buffer instead of creating a new one

Returns

void